package com.atguigu.edu.pubshier.mapper;

import com.atguigu.edu.pubshier.beans.TradeProvinceOrderAmount;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * @author: techyang
 * @since: 2023-10-22 18:26
 * @description:
 **/
@Mapper
public interface TradeStatsMapper {

    @Select("select subject_name,sum(final_amount) value " +
            "from dws_trade_course_order_window partition par#{date} group by subject_name")
    List<Map<String,Object>> selectSubjectAmount(@Param("date") Integer date);

    @Select("select subject_name,sum(order_count) value " +
            "from dws_trade_course_order_window partition par#{date} group by subject_name")
    List<Map<String,Object>> selectSubjectOrderCount(@Param("date") Integer date);

    @Select("select subject_name,sum(order_user_count) value " +
            "from dws_trade_course_order_window partition par#{date} group by subject_name")
    List<Map<String,Object>> selectSubjectOrderUserCount(@Param("date") Integer date);

    //获取某天各个省份的交易额
    @Select("select province_name,sum(order_final_amount) order_amount, sum(order_count) order_count,sum(order_number) order_number from dws_trade_province_order_window partition par#{date} group by province_name; ")
    List<TradeProvinceOrderAmount> selectProvinceAmount(Integer date);
}
